home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
bsrc_250.zip
/
NODEPROC.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-15
|
36KB
|
925 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software, Co. */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / Freely Available<tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
/* */
/* */
/* This module was written by Vince Perriello */
/* */
/* */
/* BinkleyTerm Nodelist processing module */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.250. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */
/* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */
/* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */
/* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */
/* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */
/* */
/* */
/* You can contact Bit Bucket Software Co. at any one of the following */
/* addresses: */
/* */
/* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */
/* P.O. Box 460398 AlterNet 7:491/0 */
/* Aurora, CO 80046 BBS-Net 86:2030/1 */
/* Internet f491.n343.z1.fidonet.org */
/* */
/* Please feel free to contact us at any time to share your comments about */
/* our software and/or licensing policies. */
/* */
/*--------------------------------------------------------------------------*/
/* Include this file before any other includes or defines! */
#include "includes.h"
char far *get_size (unsigned int);
int get_new_info (unsigned);
#ifdef OLDTBBSLIST
int get_TBBS_info (unsigned, ADDR *);
#endif
#ifdef V5_LIST
int get_old_info (unsigned);
#endif
static off_t index_filesize = (off_t) 0L;
static time_t index_filetime = (time_t) 0L;
static char index_filename[80];
static unsigned int idx_size = 0; /* number of entries */
static int extra_bytes = 0;
static char *curr_domain = NULL;
void get_nodelist_name (ADDR *);
void get_nodelist_name (ADDRP opus_addr)
{
int i;
curr_domain = opus_addr->Domain;
idx_size = 0;
extra_bytes = 0;
nodelist_base = nodelist_name;
for (i = 0; domain_name[i] != NULL; i++)
{
if (domain_name[i] == opus_addr->Domain)
{
nodelist_base = domain_nodelist[i];
if (nodelist_base == NULL)
nodelist_base = nodelist_name;
}
}
}
char far *get_size (unsigned int n)
{
/* If we get this far, then we have to use a straight far pointer */
return (_fmalloc(n));
}
/*---------------------------------------------------------------------------*/
/* CHECKLIST */
/* See if nodelist has changed since we first tried to use it and if so, */
/* dismiss old copy and get a new one */
/*---------------------------------------------------------------------------*/
int checklist ()
{
struct stat idxstat;
if (index_filesize == (off_t)0L)
return (0);
(void) stat (index_filename, &idxstat);
if ((index_filesize == idxstat.st_size) && (index_filetime == idxstat.st_mtime))
return (0);
status_line (MSG_TXT(M_REFRESH_NODELIST));
_ffree( node_index );
node_index = (char far *) NULL;
index_filesize = (off_t)0L;
return (1);
}
/*---------------------------------------------------------------------------*/
/* NODEPROC */
/* Find nodelist entry and set baud to nodelist baud for dialing out */
/*---------------------------------------------------------------------------*/
int nodeproc (char *nodeaddr)
{
ADDR opus_addr;
char *c;
c = skip_blanks (nodeaddr); /* get rid of the blanks */
if (!find_address (c, &opus_addr))
{
return (0);
}
if (!nodefind (&opus_addr, 1)) /* if we can't find the node */
return (0); /* go away now */
status_line (MSG_TXT(M_PROCESSING_NODE), Full_Addr_Str (&opus_addr), newnodedes.SystemName);
if (!CARRIER) /* if no carrier yet, */
{
if (autobaud)
(void) set_baud (max_baud.rate_value, 1); /* Set to highest rate*/
else
(void) set_baud ((300 * newnodedes.BaudRate), 1);/* nodelist baud */
}
return (1); /* return success to caller */
}
/*---------------------------------------------------------------------------*/
/* NODEFIND */
/* Find nodelist entry for use by other routines (password, nodeproc) */
/* If found, result will be in "newnodedes". */
/*---------------------------------------------------------------------------*/
int nodefind (ADDRP bink_addr, int prtflag)
{
int i, j, k;
int have_boss_data = 0;
int need_boss_data = 0;
(void) checklist ();
newnodedes.NetNumber = newnodedes.NodeNumber = found_zone = found_net = 0;
CURRENT = DEFAULT; /* Set default paths, quotas */
if ((bink_addr->Net == boss_addr.Net)
&& (bink_addr->Node == boss_addr.Node)
&& (bink_addr->Zone == alias[0].Zone)
&& ((bink_addr->Domain == boss_addr.Domain) || (bink_addr->Domain == NULL)))
{
++need_boss_data;
if (BOSSphone && strlen (BOSSphone) > 2)
++have_boss_data;
if (BOSSpwd && strlen (BOSSpwd) > 2)
++have_boss_data;
}
if (!bink_addr->Zone)
{
bink_addr->Zone = alias[0].Zone;
i = (*nodefunc) (bink_addr, have_boss_data);
if (i) goto lookup_done;
}
i = (*nodefunc) (bink_addr, have_boss_data);
lookup_done:
assum